<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>AIfES 2: ailayer_maxpool2d Struct Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="AIfES_logo_small.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">AIfES 2
   &#160;<span id="projectnumber">2.0.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('structailayer__maxpool2d.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#pub-attribs">Data Fields</a>  </div>
  <div class="headertitle">
<div class="title">ailayer_maxpool2d Struct Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>General <a class="el" href="ailayer__maxpool2d_8h.html">layer </a> structure.  
 <a href="structailayer__maxpool2d.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="ailayer__maxpool2d_8h_source.html">ailayer_maxpool2d.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Data Fields</h2></td></tr>
<tr class="memitem:ab13782a46e3804246bf82a92955096b3"><td class="memItemLeft" align="right" valign="top"><a id="ab13782a46e3804246bf82a92955096b3"></a>
<a class="el" href="structailayer.html">ailayer_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__maxpool2d.html#ab13782a46e3804246bf82a92955096b3">base</a></td></tr>
<tr class="memdesc:ab13782a46e3804246bf82a92955096b3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Inherited field members from general ailayer struct. <br /></td></tr>
<tr class="separator:ab13782a46e3804246bf82a92955096b3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2228267b8286358702df06ee781106b6"><td class="memItemLeft" align="right" valign="top"><a id="a2228267b8286358702df06ee781106b6"></a>
uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__maxpool2d.html#a2228267b8286358702df06ee781106b6">result_shape</a> [4]</td></tr>
<tr class="memdesc:a2228267b8286358702df06ee781106b6"><td class="mdescLeft">&#160;</td><td class="mdescRight">The shape of the result. <br /></td></tr>
<tr class="separator:a2228267b8286358702df06ee781106b6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr><td colspan="2"><div class="groupHeader">Layer configuration</div></td></tr>
<tr><td colspan="2"><div class="groupText"><p>Required configuration parameters for the layer</p>
<p>These fields have to be configured by the user before calling the initializer function. </p>
</div></td></tr>
<tr class="memitem:ad05b3ff44540cdb867f4ba378e6946ac"><td class="memItemLeft" align="right" valign="top"><a id="ad05b3ff44540cdb867f4ba378e6946ac"></a>
uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__maxpool2d.html#ad05b3ff44540cdb867f4ba378e6946ac">pool_size</a> [2]</td></tr>
<tr class="memdesc:ad05b3ff44540cdb867f4ba378e6946ac"><td class="mdescLeft">&#160;</td><td class="mdescRight">Size of the pooling kernel ( \( [H_{pool}, W_{pool}] \)). <br /></td></tr>
<tr class="separator:ad05b3ff44540cdb867f4ba378e6946ac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aae9b175c98f22cb88ce0ad348b075d14"><td class="memItemLeft" align="right" valign="top"><a id="aae9b175c98f22cb88ce0ad348b075d14"></a>
uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__maxpool2d.html#aae9b175c98f22cb88ce0ad348b075d14">stride</a> [2]</td></tr>
<tr class="memdesc:aae9b175c98f22cb88ce0ad348b075d14"><td class="mdescLeft">&#160;</td><td class="mdescRight">The stride in the direction of height and width ( \( [S_{h}, S_{w}] \)). <br /></td></tr>
<tr class="separator:aae9b175c98f22cb88ce0ad348b075d14"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a959391eb5884c07d76585cdc37480edf"><td class="memItemLeft" align="right" valign="top"><a id="a959391eb5884c07d76585cdc37480edf"></a>
uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__maxpool2d.html#a959391eb5884c07d76585cdc37480edf">padding</a> [2]</td></tr>
<tr class="memdesc:a959391eb5884c07d76585cdc37480edf"><td class="mdescLeft">&#160;</td><td class="mdescRight">The (symmetric) minus infinity padding in the direction of height and width ( \( [P_{h}, P_{w}], \; 0 \leq P_h &lt; H_{pool}, 0 \leq P_w &lt; W_{pool} \)). <br /></td></tr>
<tr class="separator:a959391eb5884c07d76585cdc37480edf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afcee94774a3c5f173a071b67da9cc3a5"><td class="memItemLeft" align="right" valign="top"><a id="afcee94774a3c5f173a071b67da9cc3a5"></a>
int8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__maxpool2d.html#afcee94774a3c5f173a071b67da9cc3a5">channel_axis</a></td></tr>
<tr class="memdesc:afcee94774a3c5f173a071b67da9cc3a5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Index of the channel axis (1 for channels first and -1 or 3 for channels last). <br /></td></tr>
<tr class="separator:afcee94774a3c5f173a071b67da9cc3a5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr><td colspan="2"><div class="groupHeader">Training parameters</div></td></tr>
<tr><td colspan="2"><div class="groupText"><p>Data fields required for the training of the layer </p>
</div></td></tr>
<tr class="memitem:a35cf89822e8b7b6f813cb86a9f874e48"><td class="memItemLeft" align="right" valign="top"><a id="a35cf89822e8b7b6f813cb86a9f874e48"></a>
uint32_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__maxpool2d.html#a35cf89822e8b7b6f813cb86a9f874e48">max_locations</a></td></tr>
<tr class="memdesc:a35cf89822e8b7b6f813cb86a9f874e48"><td class="mdescLeft">&#160;</td><td class="mdescRight">Pointer to memory section where the indices of the maximum values per pooling window are stored. <br /></td></tr>
<tr class="separator:a35cf89822e8b7b6f813cb86a9f874e48"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a590c48e998a8a740439e38d0aa4302dd"><td class="memItemLeft" align="right" valign="top"><a id="a590c48e998a8a740439e38d0aa4302dd"></a>
void *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__maxpool2d.html#a590c48e998a8a740439e38d0aa4302dd">optimem</a> [2]</td></tr>
<tr class="memdesc:a590c48e998a8a740439e38d0aa4302dd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Memory field used by the optimizer for training. <br /></td></tr>
<tr class="separator:a590c48e998a8a740439e38d0aa4302dd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr><td colspan="2"><div class="groupHeader">Math functions</div></td></tr>
<tr><td colspan="2"><div class="groupText"><p>Required data type specific math functions </p>
</div></td></tr>
<tr class="memitem:a7d262800ae2b6fe796707e30a6c75c7d"><td class="memItemLeft" align="right" valign="top">void(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__maxpool2d.html#a7d262800ae2b6fe796707e30a6c75c7d">maxpool2d_fwd</a> )(const <a class="el" href="structaitensor.html">aitensor_t</a> *input, const uint16_t <a class="el" href="structailayer__maxpool2d.html#ad05b3ff44540cdb867f4ba378e6946ac">pool_size</a>[2], const uint16_t <a class="el" href="structailayer__maxpool2d.html#aae9b175c98f22cb88ce0ad348b075d14">stride</a>[2], const uint16_t <a class="el" href="structailayer__maxpool2d.html#a959391eb5884c07d76585cdc37480edf">padding</a>[2], int8_t <a class="el" href="structailayer__maxpool2d.html#afcee94774a3c5f173a071b67da9cc3a5">channel_axis</a>, void *work_space, uint32_t *<a class="el" href="structailayer__maxpool2d.html#a35cf89822e8b7b6f813cb86a9f874e48">max_locations</a>, <a class="el" href="structaitensor.html">aitensor_t</a> *output)</td></tr>
<tr class="memdesc:a7d262800ae2b6fe796707e30a6c75c7d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Required math function: 2D Max-Pooling.  <a href="structailayer__maxpool2d.html#a7d262800ae2b6fe796707e30a6c75c7d">More...</a><br /></td></tr>
<tr class="separator:a7d262800ae2b6fe796707e30a6c75c7d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa70a34f7f0274c5ce34bb63aff19f70f"><td class="memItemLeft" align="right" valign="top">void(*&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structailayer__maxpool2d.html#aa70a34f7f0274c5ce34bb63aff19f70f">maxpool2d_bwd</a> )(const <a class="el" href="structaitensor.html">aitensor_t</a> *delta_out, const uint16_t <a class="el" href="structailayer__maxpool2d.html#ad05b3ff44540cdb867f4ba378e6946ac">pool_size</a>[2], const uint16_t <a class="el" href="structailayer__maxpool2d.html#aae9b175c98f22cb88ce0ad348b075d14">stride</a>[2], const uint16_t <a class="el" href="structailayer__maxpool2d.html#a959391eb5884c07d76585cdc37480edf">padding</a>[2], int8_t <a class="el" href="structailayer__maxpool2d.html#afcee94774a3c5f173a071b67da9cc3a5">channel_axis</a>, void *work_space, const uint32_t *<a class="el" href="structailayer__maxpool2d.html#a35cf89822e8b7b6f813cb86a9f874e48">max_locations</a>, <a class="el" href="structaitensor.html">aitensor_t</a> *delta_in)</td></tr>
<tr class="memdesc:aa70a34f7f0274c5ce34bb63aff19f70f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Required math function: Gradients of 2D Max-Pooling with respect to the input.  <a href="structailayer__maxpool2d.html#aa70a34f7f0274c5ce34bb63aff19f70f">More...</a><br /></td></tr>
<tr class="separator:aa70a34f7f0274c5ce34bb63aff19f70f"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>General <a class="el" href="ailayer__maxpool2d_8h.html">layer </a> structure. </p>
</div><h2 class="groupheader">Field Documentation</h2>
<a id="aa70a34f7f0274c5ce34bb63aff19f70f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa70a34f7f0274c5ce34bb63aff19f70f">&#9670;&nbsp;</a></span>maxpool2d_bwd</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void(* maxpool2d_bwd) (const <a class="el" href="structaitensor.html">aitensor_t</a> *delta_out, const uint16_t <a class="el" href="structailayer__maxpool2d.html#ad05b3ff44540cdb867f4ba378e6946ac">pool_size</a>[2], const uint16_t <a class="el" href="structailayer__maxpool2d.html#aae9b175c98f22cb88ce0ad348b075d14">stride</a>[2], const uint16_t <a class="el" href="structailayer__maxpool2d.html#a959391eb5884c07d76585cdc37480edf">padding</a>[2], int8_t <a class="el" href="structailayer__maxpool2d.html#afcee94774a3c5f173a071b67da9cc3a5">channel_axis</a>, void *work_space, const uint32_t *<a class="el" href="structailayer__maxpool2d.html#a35cf89822e8b7b6f813cb86a9f874e48">max_locations</a>, <a class="el" href="structaitensor.html">aitensor_t</a> *delta_in)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Required math function: Gradients of 2D Max-Pooling with respect to the input. </p>
<p>Requires a math function that calculates the gradients with respect to the input \( delta_{in} = \mathrm{d} L / \mathrm{d} x_{in} \).</p>
<p>This is done by simply copying the output gradient to the position in the input gradients depicted by max_locations.<br  />
An element of max_locations consist of the concatenated 16-bit indices for height and width in the pooling window.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">delta_out</td><td>Gradients backpropagated from the following layer with dimension \( [N,C,H_{out},W_{out}] \) (channels first) or \( [N,H_{out},W_{out},C] \) (channels last) </td></tr>
    <tr><td class="paramname">pool_size</td><td>The size of the pooling window (height and width) </td></tr>
    <tr><td class="paramname">stride</td><td>The stride in the direction of height and width. </td></tr>
    <tr><td class="paramname">padding</td><td>The (symmetric) minus infinity padding in the direction of height and width </td></tr>
    <tr><td class="paramname">channel_axis</td><td>Index of the channel axis (1 for channels first and -1 or 3 for channels last). </td></tr>
    <tr><td class="paramname">workspace</td><td>Pointer to a work space buffer for intermediate results. </td></tr>
    <tr><td class="paramname">max_locations</td><td>Pointer to memory section where the indices of the maximum values per pooling window are stored. </td></tr>
    <tr><td class="paramname">delta_in</td><td>Resulting input gradients for backpropagation to the previous layer \( [N,C,H_{in},W_{in}] \) (channels first) or \( [N,H_{in},W_{in},C] \) (channels last) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a7d262800ae2b6fe796707e30a6c75c7d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7d262800ae2b6fe796707e30a6c75c7d">&#9670;&nbsp;</a></span>maxpool2d_fwd</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void(* maxpool2d_fwd) (const <a class="el" href="structaitensor.html">aitensor_t</a> *input, const uint16_t <a class="el" href="structailayer__maxpool2d.html#ad05b3ff44540cdb867f4ba378e6946ac">pool_size</a>[2], const uint16_t <a class="el" href="structailayer__maxpool2d.html#aae9b175c98f22cb88ce0ad348b075d14">stride</a>[2], const uint16_t <a class="el" href="structailayer__maxpool2d.html#a959391eb5884c07d76585cdc37480edf">padding</a>[2], int8_t <a class="el" href="structailayer__maxpool2d.html#afcee94774a3c5f173a071b67da9cc3a5">channel_axis</a>, void *work_space, uint32_t *<a class="el" href="structailayer__maxpool2d.html#a35cf89822e8b7b6f813cb86a9f874e48">max_locations</a>, <a class="el" href="structaitensor.html">aitensor_t</a> *output)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Required math function: 2D Max-Pooling. </p>
<p>Requires a math function that extracts the maximum from a kernel window.</p>
<p>For training (max_locations != 0), the index of the max-value in the kernel window must be stored in max_locations.<br  />
An element of max_locations simply consist of the concatenated 16-bit indices for height and width in the pooling window.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">input</td><td>Input data with dimension \( [N,C,H_{in},W_{in}] \) (channels first) or \( [N,H_{in},W_{in},C] \) (channels last) </td></tr>
    <tr><td class="paramname">pool_size</td><td>The size of the pooling window (height and width) </td></tr>
    <tr><td class="paramname">stride</td><td>The stride in the direction of height and width. </td></tr>
    <tr><td class="paramname">padding</td><td>The (symmetric) minus infinity padding in the direction of height and width </td></tr>
    <tr><td class="paramname">channel_axis</td><td>Index of the channel axis (1 for channels first and -1 or 3 for channels last). </td></tr>
    <tr><td class="paramname">workspace</td><td>Pointer to a work space buffer for intermediate results. </td></tr>
    <tr><td class="paramname">max_locations</td><td>Pointer to memory section where the indices of the maximum values per pooling window are stored. </td></tr>
    <tr><td class="paramname">output</td><td>Output after max-pooling with dimension \( [N,C,H_{out},W_{out}] \) (channels first) or \( [N,H_{out},W_{out},C] \) (channels last) </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<hr/>The documentation for this struct was generated from the following file:<ul>
<li><a class="el" href="ailayer__maxpool2d_8h_source.html">ailayer_maxpool2d.h</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="structailayer__maxpool2d.html">ailayer_maxpool2d</a></li>
    <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
  </ul>
</div>
</body>
</html>
